package com.heima.wemedia.uitls;

import com.heima.model.wemedia.pojos.WmUser;

public class ThreadLocalUtils {
    //创建threadlocal对象
    private static final ThreadLocal<WmUser> WM_THREADLOCAL = new ThreadLocal<>();
    //定义向线程中存值的静态方法
    public static  void  setUser(WmUser wmUser){
        WM_THREADLOCAL.set(wmUser);
    }
    //定义从线程中获取数据的方法
    public static  WmUser getUser(){
        return WM_THREADLOCAL.get();
    }

    //删除数据
    public static  void removeUser(){
        WM_THREADLOCAL.remove();
    }

}
